﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";      
}
@section Head
{
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            var maiheight = document.documentElement.clientHeight-200;
            var mainWidth = document.documentElement.clientWidth - 3 - 20; // 减去边框和左边的宽度
            var otherpm = 113;
            var gh = maiheight - otherpm;
            var option = {
                height: maiheight,
                width: mainWidth,
                url: '@Url.Action("GetSel")', // 参数要放在）括号的外面
                dataType: 'json',
                colModel: [
					{ display: 'UserLogName', name: 'UserLogName', width: 100, sortable: false, hide: false, align: 'left', iskey: true },
					{ display: 'UserName', name: 'UserName', width: 100, sortable: false, hide: false, align: 'left' },
					{ display: 'QuanXian', name: 'QuanXian', width: 150, sortable: false, align: 'left' }
				],
                title: false,
                singleselected: true,
                usepager: true,
                resizable: true,
                page: 1, //默认当前页  
                total: 1, //总页面数  
                useRp: true, //是否可以动态设置每页显示的结果数  
                rp: 10, // 每页默认的结果数  
                rpOptions: [10, 15, 20], //可选择设定的每页结果数
                showcheckbox: true,
                selectedonclick: true,
                rowbinddata: true
            };
            //000000001
            //$("#userlist").flexigrid(option);

            $("#sel").click(function () {
                $.ajax({
                    url: '@Url.Action("GetUserName")',
                    type: "POST",
                    data: { },
                    success: function (callback) {
                        if (callback) {
                            $("#tbsel").val(callback);
                        }
                    },
                    error: function () {
                        alert("保存时发生异常！");
                    }
                });
                //$("#tbsel").val("callback");
            });
        });
    </script>
}


<div style="padding:0px,0px 0px 10px;">    
    <div style="height:30px;"></div>
    @Html.TextBox("tbsel", "", new { @style="width:300px;"})&nbsp;&nbsp;    
    <a id="sel" href="javascript:void(0);"><span>保存</span></a>
    
    <table id="userlist" style="display:none;">
    </table>
</div>

